#include "media_sys.h"



int main()
{

    MEDIA_POI mp = Media_Sys_Init();
    if(mp == (MEDIA_POI)-1)
    {
        printf("media sys init failed ...\n");
        return -1;
    }
    Chinese_Show_Init(0x000000, 0xffffff);
    Word_Show_Init(0x000000, 0xffffff);

    Lcd_Clean(mp, 0x00ffffff);

    for (int i = 0; i <= 100; i++) 
    {
        Show_Progress_Bar(mp, i);
        usleep(100); // 暂停10ms
    }

    // 进度条完成，显示主界面
    if (Show_Ui(mp, "/tmp/main_ui.bmp") == false) 
    {
        printf("显示主界面失败！\n");
        return -1;
    }

// 创建时间显示线程
    pthread_t thread = -1;
    if (pthread_create(&thread, NULL, time_display_thread, (void*)mp) != 0) 
    {
        perror("pthread_create time_display_thread");
        return -1;
    }

    // // 创建文字显示线程
    // pthread_t pthread = -1;
    // if (pthread_create(&pthread, NULL, word_display_thread, (void*)mp) != 0) 
    // {
    //     perror("pthread_create word_display_thread");
    //     return -1;
    // }

    //主界面触摸函数
    if(Main_Touch_Ctrl(mp) == false)
    {
        printf("主界面触摸屏控制失败！\n");
        return -1;
    }


    //结束释放就行了
    if(Media_Sys_Free(mp) == false)
    {
        printf("media sys free failed ...\n");
        return -1;
    }

    return 0;
}